package com.huifaapp.mall.bean;

import android.util.Log;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;

/**
 * Created by Administrator on 2018/1/8.
 */

public class UserMyShoppingCart {


    public static class Attr {
        public static final String GOODSNAME = "goodsName";
        public static final String GOODSIMG = "goodsImg";
        public static final String COUPONID = "couponId";
        public static final String PARAM = "param";
        public static final String CARTID = "cartId";
        public static final String GOODSID = "goodsId";
        public static final String ISREVICE = "isRevice";
        public static final String ID="id";
    }

    public UserMyShoppingCart(String id,String goodsName, String goodsImg, double actualpay, double couponAmount, String couponId,
                              double originPrice, String param, Integer count, String cartId, String goodsId, String isRevice,String isOutDate) {
        this.id=id;
        this.goodsName = goodsName;
        this.goodsImg = goodsImg;
        this.actualpay = actualpay;
        this.couponAmount = couponAmount;
        this.couponId = couponId;
        this.originPrice = originPrice;
        this.param = param;
        this.count = count;
        this.cartId = cartId;
        this.goodsId = goodsId;
        this.isRevice = isRevice;
        this.isOutDate=isOutDate;
    }





    /**
     * goodsName :
     * goodsImg :
     * actualpay : 0.0
     * couponAmount : 0.0
     * couponId :
     * originPrice : 0.0
     * param :
     * count : 0
     */
    private String id;
    private String goodsName;
    private String goodsImg;
    private double actualpay;
    private double couponAmount;
    private String couponId;
    private String cartId;
    private String goodsId;
    private double originPrice;
    private String param;
    private int count;

    private String isRevice;
    private String isOutDate;
    public boolean isChoosed;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getIsRevice() {
        return isRevice;
    }

    public void setIsRevice(String isRevice) {
        this.isRevice = isRevice;
    }

    public String getGoodsId() {
        return goodsId;
    }

    public void setGoodsId(String goodsId) {
        this.goodsId = goodsId;
    }

    public String getCartId() {
        return cartId;
    }

    public void setCartId(String cartId) {
        this.cartId = cartId;
    }

    public boolean isChoosed() {
        return isChoosed;
    }

    public void setChoosed(boolean choosed) {
        isChoosed = choosed;
    }

    public String getGoodsName() {
        return goodsName;
    }

    public void setGoodsName(String goodsName) {
        this.goodsName = goodsName;
    }

    public String getGoodsImg() {
        return goodsImg;
    }

    public void setGoodsImg(String goodsImg) {
        this.goodsImg = goodsImg;
    }

    public double getActualpay() {
        return actualpay;
    }

    public void setActualpay(double actualpay) {
        this.actualpay = actualpay;
    }

    public double getCouponAmount() {
        return couponAmount;
    }

    public void setCouponAmount(double couponAmount) {
        this.couponAmount = couponAmount;
    }

    public String getCouponId() {
        return couponId;
    }

    public void setCouponId(String couponId) {
        this.couponId = couponId;
    }

    public double getOriginPrice() {
        return originPrice;
    }

    public void setOriginPrice(double originPrice) {
        this.originPrice = originPrice;
    }

    public String getParam() {
        return param;
    }

    public void setParam(String param) {
        this.param = param;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public String getIsOutDate() {
        return isOutDate;
    }

    public void setIsOutDate(String isOutDate) {
        this.isOutDate = isOutDate;
    }

    public static ArrayList<UserMyShoppingCart> newInstanceList(String jsonDatas) {
        ArrayList<UserMyShoppingCart> AdvertDatas = new ArrayList<UserMyShoppingCart>();

        try {
            JSONArray arr = new JSONArray(jsonDatas);
            int size = null == arr ? 0 : arr.length();
            for (int i = 0; i < size; i++) {
                JSONObject obj = arr.getJSONObject(i);
                Log.e("tag", obj + "");
                String id=obj.getString(Attr.ID);
                String goodsName = obj.getString(Attr.GOODSNAME);
                String goodsImg = obj.getString(Attr.GOODSIMG);
                double actualpay = obj.getDouble("actualpay");
                double couponAmount = obj.getDouble("couponAmount");
                String couponId = obj.getString(Attr.COUPONID);
                double originPrice = obj.getDouble("originPrice");
                String param = obj.getString(Attr.PARAM);
                Integer count = obj.getInt("count");
                String cartId = obj.getString(Attr.CARTID);
                String goodsId = obj.getString(Attr.GOODSID);
                String isRevice = obj.getString(Attr.ISREVICE);
                String isOutDate=obj.getString("isOutDate");

                AdvertDatas.add(new UserMyShoppingCart(id,goodsName, goodsImg, actualpay, couponAmount, couponId, originPrice, param, count, cartId, goodsId, isRevice,isOutDate));
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return AdvertDatas;
    }

    public static class ParamBean {
    }
}